home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 172 / 172.d81 / b.star batch (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  12KB  |  722 lines

  1. 10 rem * star batch creator   *
  2. 11 rem * by ken robinson 5/98 *
  3. 12 rem * 1998 j&f publishing  *
  4. 13 :
  5. 14 poke55,0:poke56,160:clr
  6. 15 dv=peek(186):ifdv<8thendv=8
  7. 16 :
  8. 17 c1$="\":rem * delay character *
  9. 18 c2$="_":rem * input character *
  10. 19 :
  11. 20 deffnh(q)=int(q/256)
  12. 21 deffnl(q)=q-256*fnh(q)
  13. 22 diml(100)
  14. 30 poke53272,23:poke648,4:poke56576,199:gosub5000
  15. 31 print"  [155][197][206][212][197][210] [201][206][211][212][193][204][204][193][212][201][207][206] [193][196][196][210][197][211][211]"
  16. 32 print"  [155][193]ccepts dec or $hex"
  17. 33 print"  like 49152 or $c000":poke53265,27
  18. 34 print"  [201]nstallation [193]ddress: ? ";
  19. 35 gosub800:ifef=2then39000
  20. 36 ifef=1thenprint"[150][201]llegal number!":goto34
  21. 37 ifn<2352orn>52736or(n>40448andn<49152)thenprint"[150][195]an't fit it there!":goto34
  22. 38 sa=n:s2=sa+256:b1=40960:ifsa>40704thenb1=53248
  23. 39 b2=49408+(b1-s2):ifb2>53248thenb2=53248
  24. 40 df=49152-sa
  25. 99 rem   stop
  26. 200 gosub5000:gosub5005:poke53265,27
  27. 230 print
  28. 232 print"[159] [201]nstall. [193]ddr. =";sa;:n=sa:gosub850:printw$:print
  29. 235 s3=49408:print"[159]"b2-s3;"bytes free":print:ln=1
  30. 238 ln$="[147][144]poke53280,0:poke53281,0"
  31. 239 l(1)=s3:poke198,0:print"";ln;"[157]:";:poke212,1:println$;:goto265
  32. 240 ln$="":l(ln)=s3
  33. 245 poke198,0:print"";ln;"[157]:";:goto265
  34. 250 tt=ti+20
  35. 255 iftt>tithen270
  36. 260 tf=not(tf):iftf=0thenpoke212,0:print" [157]";:goto250
  37. 265 poke212,0:print" [146][157]";:goto250
  38. 270 geta$:ifa$=""then255
  39. 275 ifa$=chr$(148)thena$=chr$(142)
  40. 280 ifln$=""thenifa$=chr$(20)then255
  41. 290 ifa$=chr$(13)ora$=chr$(141)ora$=""then319
  42. 295 ifa$=""then355
  43. 300 ifa$=""then349
  44. 302 ifa$=""thenpoke212,0:print" ":goto39000
  45. 303 ifa$=""then352
  46. 304 ifa$=""then346
  47. 305 iflen(ln$)=>75thenifa$<>chr$(20)then255
  48. 308 poke212,1:printa$;
  49. 310 ifa$<>chr$(20)thenln$=ln$+a$:goto265
  50. 315 ln$=left$(ln$,len(ln$)-1):goto265
  51. 319 ifln=>100orln$=""then255
  52. 320 poke212,0:ifa$=chr$(13)thenprint"m[146]"
  53. 321 ifa$=chr$(141)thenprint"[205][146]"
  54. 322 ifa$=""thenprint"l[146]":a$=""
  55. 323 ln$=ln$+a$
  56. 325 l=len(ln$):ifl=0then345
  57. 326 ifb2-(s3+l+1)=<0thenprint"[150][207]verflow!!! [210]etype line or quit.":goto240
  58. 330 forx=0tolen(ln$)-1
  59. 335 pokes3,asc(mid$(ln$,x+1,1)+chr$(0)):s3=s3+1
  60. 340 nextx:pokes3,0
  61. 345 ln=ln+1:goto240
  62. 346 ifln$<>""orln<2then255
  63. 347 poke212,0:print" "
  64. 348 ln=ln-1:s3=l(ln):pokes3,0:goto240
  65. 349 ifln$<>""then255
  66. 350 poke212,0:print" "
  67. 351 print:print"[159]"b2-s3"bytes free":goto240
  68. 352 ifln$=""then255
  69. 353 poke212,0:forj=1tolen(ln$):print" [157][157]";:next:ln$="":goto260
  70. 355 ifs3=49408orln$<>""then255
  71. 357 poke212,0:print" "
  72. 358 print"[155][195]onfirm - are you finished? (y/n)";
  73. 359 poke198,0
  74. 360 geta$:ifa$<>"y"anda$<>"n"then360
  75. 365 printa$:ifa$="n"thenprint:goto240
  76. 370 gosub5000:print:printtab(8);"[155][208][210][207][195][197][211][211][201][206][199][160][194][193][212][195][200][160][198][201][204][197]..."
  77. 375 printtab(8)"* * * * * * * * * * * *"
  78. 380 printtab(8)"[145]";:poke53265,27
  79. 385 ad=sa:gosub1000
  80. 390 gosub5000:poke53265,27
  81. 392 print"[155][197]nter [211]ave [198]ilename: ? ";:nf=0:l=15:w$="":gosub830
  82. 395 ifw$=""then38000
  83. 396 fl$=w$
  84. 397 print"[155][197]nter [211]ave [196]evice # ? ";
  85. 398 w$=mid$(str$(dv),2):print"[159]";w$;:l=2:gosub804
  86. 399 ifef=2then38000
  87. 400 if(ef)or(n<8orn>29)then397
  88. 402 open2,n,2:close2:ifstthen397
  89. 404 dv=n
  90. 410 close15:open15,dv,15:ifstthenprint"[150][196]evice not present!":goto492
  91. 415 close2:open2,dv,2,"0:"+fl$+",p,w"
  92. 420 input#15,er,er$,et,es:ifer=0then530
  93. 422 close2:ifer<>63then490
  94. 424 print"[150][198]ile exists! [196]elete it? (y/n) ";
  95. 425 poke198,0
  96. 426 geta$:ifa$<>"y"anda$<>"n"then426
  97. 428 printa$:ifa$="n"then400
  98. 430 print#15,"s0:"+fl$:goto415
  99. 490 print"[150][196]isk error: ";er$
  100. 492 close2:close15:print"[158][208]ress [211][208][193][195][197] [194][193][210] to continue."
  101. 494 poke198,0:wait198,1:geta$:goto390
  102. 500 rem * save batch file *
  103. 530 restore
  104. 535 s1=sa
  105. 540 ea=sa+(s3+1-49152)
  106. 545 ee=ea-s1+2093:eh=fnh(ee):el=fnl(ee)
  107. 550 sy=sa
  108. 565 print"[211]aving [194]atch [198]ile...."
  109. 585 gosub625
  110. 595 forx=49152tos3+1
  111. 600 a=peek(x)
  112. 605 print#2,chr$(a);
  113. 615 next:close2:close15:goto38000
  114. 620 rem
  115. 625 reada:ifa<0thenonabs(a)gosub645,650,655,660,665,670
  116. 630 print#2,chr$(a);
  117. 635 ife=0then625
  118. 640 return
  119. 645 a=el:return
  120. 650 a=eh:return
  121. 655 a=fnl(ea+1):return
  122. 660 a=fnh(ea+1):return
  123. 665 a=fnl(sy):return
  124. 670 a=fnh(sy):e=1:return
  125. 675 rem
  126. 680 ifleft$(a$,1)="$"andlen(a$)=5thena$=right$(a$,4):gosub690:return
  127. 685 a=val(a$):return
  128. 690 a=0:p=4096:forx=1to4:l$=mid$(a$,x,1):gosub710:a=a+p*n
  129. 695 p=p/16
  130. 700 nextx:return
  131. 705 rem
  132. 710 n=0
  133. 715 n=-15*(l$="f")-14*(l$="e")-13*(l$="d")-12*(l$="c")-11*(l$="b")-10*(l$="a")
  134. 720 ifn=0thenn=val(l$)
  135. 725 return
  136. 730 rem
  137. 735 rem
  138. 740 data1,8
  139. 745 rem
  140. 750 data12,8,10,0,158,32,50,48,54,50,0,0,0
  141. 755 rem
  142. 760 data169,44,133,95,169,8,133,96
  143. 765 data169,-1,133,90,169,-2,133,91
  144. 770 data169,-3,133,88,169,-4,133,89
  145. 775 data32,191,163,76,-5,-6
  146. 780 input#15,er,er$,et,es:ifer=0thenreturn
  147. 785 print" disk error [146]"er;er$;et;es
  148. 790 close1:close2:close15
  149. 795 poke198,0:wait198,1:return
  150. 800 l=4:w$=""
  151. 804 ef=0:n=0:nf=-1:gosub830
  152. 806 ifw$=""thenef=2:return
  153. 808 ifasc(w$)=36then814
  154. 810 n=val(w$):if n=0 and w$<>"0"thenef=1
  155. 811 if n<0orn=>16^lthenef=1
  156. 812 return
  157. 814 iflen(w$)<>l+1thenef=1:return
  158. 816 forxx=0tol-1
  159. 818 yy=asc(mid$(w$,l+1-xx,1))and127
  160. 820 yy=yy-48:ifyy>9thenyy=yy-7
  161. 821 ifyy<0oryy>15thenef=1
  162. 822 n=n+yy*(16^xx):next
  163. 823 if n<0orn=>16^lthenef=1
  164. 824 return
  165. 830 poke198,0
  166. 832 tt=ti+20
  167. 834 geta$:ifa$<>""then840
  168. 836 iftt>tithen834
  169. 837 tf=not(tf):iftf=0thenprint" [157]";:goto832
  170. 838 print" [146][157]";:goto832
  171. 840 ifa$=chr$(13)thenprint" ":return
  172. 842 ifa$=chr$(20)andw$<>""thenprint" [157][157]";:w$=left$(w$,len(w$)-1):goto838
  173. 843 iflen(w$)=l+1then834
  174. 844 ifa$="0"or(val(a$)>0andval(a$)<10)then849
  175. 845 if(a$=>"a"anda$<="f")or(a$=>"[193]"anda$<="[198]")ora$="$"then849
  176. 847 ifnf=0thenif(asc(a$)and96)thenifa$<>chr$(34)then849
  177. 848 goto834
  178. 849 w$=w$+a$:print"[159]";a$;:goto838
  179. 850 w$="":forxx=0to3
  180. 852 yy=n-int(n/16)*16:ifyy>9thenyy=yy+7
  181. 854 w$=chr$(yy+48)+w$:n=int(n/16)
  182. 856 next:w$="($"+w$+")":return
  183. 980 rem * relocating test *
  184. 990 deffnh(q)=int(q/256)
  185. 991 deffnl(q)=q-256*fnh(q)
  186. 999 ad=50000:df=49152-ad:sa=ad:c1$="\":c2$="_":gosub1000:end
  187. 1000 b$="  ":a=32
  188. 1005 gosub4000
  189. 1010 a=204
  190. 1015 gosub4000
  191. 1020 a=255
  192. 1025 gosub4000
  193. 1030 a=169
  194. 1035 gosub4000
  195. 1040 a=fnl(sa+256)
  196. 1045 gosub4000
  197. 1050 a=141
  198. 1055 gosub4000
  199. 1060 a=203:a0=ad
  200. 1065 gosub4000
  201. 1070 a=192
  202. 1075 gosub4000
  203. 1080 a=169
  204. 1085 gosub4000
  205. 1090 a=fnh(sa+256)
  206. 1095 gosub4000
  207. 1100 a=141
  208. 1105 gosub4000
  209. 1110 a=204:a1=ad
  210. 1115 gosub4000
  211. 1120 a=192
  212. 1125 gosub4000
  213. 1130 a=169
  214. 1135 gosub4000
  215. 1140 a=147
  216. 1145 gosub4000
  217. 1150 a=32
  218. 1155 gosub4000
  219. 1160 a=210
  220. 1165 gosub4000
  221. 1170 a=255
  222. 1175 gosub4000
  223. 1180 a=169
  224. 1185 gosub4000
  225. 1190 a=0
  226. 1195 gosub4000
  227. 1200 printb$;:a=141
  228. 1205 gosub4000
  229. 1210 a=217:a2=ad
  230. 1215 gosub4000
  231. 1220 a=192
  232. 1225 gosub4000
  233. 1230 a=141
  234. 1235 gosub4000
  235. 1240 a=218:a3=ad
  236. 1245 gosub4000
  237. 1250 a=192
  238. 1255 gosub4000
  239. 1260 a=141
  240. 1265 gosub4000
  241. 1270 a=219:a4=ad
  242. 1275 gosub4000
  243. 1280 a=192
  244. 1285 gosub4000
  245. 1290 a=120
  246. 1295 gosub4000
  247. 1300 a=173
  248. 1305 gosub4000
  249. 1310 a=20
  250. 1315 gosub4000
  251. 1320 a=3
  252. 1325 gosub4000
  253. 1330 a=141
  254. 1335 gosub4000
  255. 1340 a=98:a5=ad
  256. 1345 gosub4000
  257. 1350 a=192
  258. 1355 gosub4000
  259. 1360 a=173
  260. 1365 gosub4000
  261. 1370 a=21
  262. 1375 gosub4000
  263. 1380 a=3
  264. 1385 gosub4000
  265. 1390 a=141
  266. 1395 gosub4000
  267. 1400 printb$;:a=99:a6=ad
  268. 1405 gosub4000
  269. 1410 a=192
  270. 1415 gosub4000
  271. 1420 a=169
  272. 1425 gosub4000
  273. 1430 a=54:a7=ad
  274. 1435 gosub4000
  275. 1440 a=141
  276. 1445 gosub4000
  277. 1450 a=20
  278. 1455 gosub4000
  279. 1460 a=3
  280. 1465 gosub4000
  281. 1470 a=169
  282. 1475 gosub4000
  283. 1480 a=192:a8=ad
  284. 1485 gosub4000
  285. 1490 a=141
  286. 1495 gosub4000
  287. 1500 a=21
  288. 1505 gosub4000
  289. 1510 a=3
  290. 1515 gosub4000
  291. 1520 a=88
  292. 1525 gosub4000
  293. 1530 a=96
  294. 1535 gosub4000
  295. 1540 a=173:pokea7+df,fnl(ad):pokea8+df,fnh(ad)
  296. 1545 gosub4000
  297. 1550 a=217:a7=ad
  298. 1555 gosub4000
  299. 1560 a=192
  300. 1565 gosub4000
  301. 1570 a=201
  302. 1575 gosub4000
  303. 1580 a=0
  304. 1585 gosub4000
  305. 1590 a=208
  306. 1595 gosub4000
  307. 1600 printb$;:a=76
  308. 1605 gosub4000
  309. 1610 a=173
  310. 1615 gosub4000
  311. 1620 a=219:a8=ad
  312. 1625 gosub4000
  313. 1630 a=192
  314. 1635 gosub4000
  315. 1640 a=201
  316. 1645 gosub4000
  317. 1650 a=0
  318. 1655 gosub4000
  319. 1660 a=208
  320. 1665 gosub4000
  321. 1670 a=32
  322. 1675 gosub4000
  323. 1680 a=165
  324. 1685 gosub4000
  325. 1690 a=198
  326. 1695 gosub4000
  327. 1700 a=201
  328. 1705 gosub4000
  329. 1710 a=0
  330. 1715 gosub4000
  331. 1720 a=208
  332. 1725 gosub4000
  333. 1730 a=23
  334. 1735